/**
 * Copyright &copy; 2012-2016 <a href="https://www.kaaction.com">KAA</a> All rights reserved.
 */
package com.kaaction.modules.eb.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.alibaba.druid.util.StringUtils;
import com.kaaction.modules.eb.dao.CommerceClassifyDao;
import com.kaaction.modules.eb.entity.CommerceClassify;

/**
 * 商品分类Service
 * @author huanghaiming
 * @version 2017-04-11
 */
@Service
@Transactional(readOnly = true)
public class CommerceClassifyService{
	
	@Autowired
	CommerceClassifyDao commerceClassifyDao;

	public CommerceClassify get(String id) {
		return commerceClassifyDao.get(id);
	}
	
	public List<CommerceClassify> findList(CommerceClassify commerceClassify) {
		return commerceClassifyDao.findList(commerceClassify);
	}
	
	@Transactional(readOnly = false)
	public void save(CommerceClassify commerceClassify) {
		String id = commerceClassify.getId();
		if(StringUtils.isEmpty(id)){
			commerceClassify.setId(commerceClassifyDao.getId());
			commerceClassifyDao.insert(commerceClassify);
		}else{
			commerceClassifyDao.update(commerceClassify);
		}
		
	}
	
	@Transactional(readOnly = false)
	public void delete(CommerceClassify commerceClassify) {
		commerceClassifyDao.delete(commerceClassify);
	}

	public List<CommerceClassify> findAllCommerceClassify() {
		return commerceClassifyDao.findAllList(new CommerceClassify());
	}
	
	
}